List of XML and HTML character entity references
In SGML, HTML and XML documents, the logical constructs known as character data and attribute values consist of sequences of characters, in which each character can manifest directly (representing itself), or can be represented by a series of characters called a character reference, of which there are two types: a numeric character reference and a character entity reference. This article lists the character entity references that are valid in HTML and XML documents. Character reference overview A numeric character reference refers to a character by its Universal Character Set/Unicode code point, and uses the format :&#''nnnn''; or :&#x''hhhh''; where nnnn is the code point in decimal form, and hhhh is the code point in hexadecimal form. The x'' must be lowercase in XML documents. The ''nnnn or hhhh may be any number of digits and may include leading zeros. The hhhh may mix uppercase and lowercase, though uppercase is the usual style. In contrast, a character entity reference refers to a character by the name of an entity which has the desired character as its replacement text. The entity must either be predefined (built-in to the markup language) or explicitly declared in a Document Type Definition (DTD). The format is the same as for any entity reference: :&''name''; where name is the name of the entity. The semicolon is required. Predefined entities in XML The XML specification does not use the term "character entity" or "character entity reference". The XML specification defines five "predefined entities" representing special characters, and requires that all XML processors honor them. The entities can be explicitly declared in a DTD, as well, but if this is done, the replacement text must be the same as the built-in definitions. XML also allows other named entities of any size to be defined on a per-document basis. The table below lists the five XML predefined entities. The "Name" column mentions the entity's name. The "Character" column shows the character, if it is renderable. In order to render the character, the format &name; is used; for example, & renders as &. The "Unicode code point" column cites the character via standard UCS/Unicode "U+" notation, which shows the character's code point in hexadecimal. The decimal equivalent of the code point is then shown in parentheses. The "Standard" column indicates the first version of XML that includes the entity. The "Description" column cites the character via its canonical UCS/Unicode name, in English. Character entities in HTML The HTML 4 DTD explicitly declares 252 character entities. HTML processors must honor the HTML DTD's declarations, even if the DTD is not mentioned in the HTML document. HTML does not allow other named entities to be defined. HTML document authors who have been exposed to XML and XHTML often overlook the fact that the apos entity is not defined in HTML. rsquo is the best alternative in this case (but it is not the same character), or authors can use a numeric character reference instead (' or ' which always designate the character using the numeric value of its Unicode code point, independently of the actual document encoding). In the table below, the HTML built-in character entities are listed. The columns are as in the XML entity table, above, except "Standard" column indicates the first version of HTML that includes the entity. The version is one of the major releases of the HTML spec: 2.0, 3.2, or 4.0. HTML 4.01 didn't introduce any new entities. Notes: * DTD: the full public DTD name (where the character entity name is defined) is actually mapped from one of the following three defined named entities: *; HTMLlat1: maps to: *:* PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed); *:* PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent" in XHTML 1.0; *; HTMLsymbol: maps to: *:* PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed); *:* PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent" in XHTML 1.0; *; HTMLspecial: maps to: *:* PUBLIC "-//W3C//ENTITIES Special//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed); *:* PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent" in XHTML 1.0. * Old ISO subset: these are old (documented) character subsets used in legacy encodings before the unification within ISO 10646. * Description: the standard ISO 10646 and Unicode character name is displayed first for each character, with non-standard but legacy synonyms shown in italics between parentheses after an equal sign) * spaces: a blue background has been used in order to display each space's width. * ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0. * ligature: this is a standard misnomer as this is a separate character in some languages. * black: here it seems to mean filled as opposed to hollow. * alefsym: 'alef symbol' is NOT the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters. * lArr: ISO 10646 does not say that 'leftwards double arrow' is the same as the 'is implied by' arrow but also does not have any other character for that function. So lArr can be used for 'is implied by' as ISOtech suggests. * rArr: ISO 10646 does not say that 'rightwards double arrow' is the 'implies' character but does not have another character with this function so rArr can be used for 'implies' as ISOtech suggests. * prod: 'n-ary product' is NOT the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both. * sum: 'n-ary summation' is NOT the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both. * sim: 'tilde operator' is NOT the same character as U+007E 'tilde', although the same glyph might be used to represent both. * sup: note that nsup, U+2283 'not a superset of', is not covered by the Symbol font encoding and is not included. Should it be, for symmetry? It is in the ISOamsn subset. * sdot: 'dot operator' is NOT the same character as U+00B7 'middle dot'. * lang: 'left-pointing angle bracket' is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark'. * rang: 'right-pointing angle bracket' is NOT the same character as U+003E 'greater than' or U+203A 'single right-pointing angle quotation mark'. Entities representing special characters in XHTML The XHTML DTDs explicitly declare 253 entities (including the 5 predefined entities of XML 1.0) whose expansion is a single character, which can therefore be informally referred to as "character entities". These (with the exception of the ' entity) have the same names and represent the same characters as the 252 character entities in HTML. Also, by virtue of being XML, XHTML documents may reference the predefined ' entity, which is not one of the 252 character entities in HTML. Additional entities of any size may be defined on a per-document basis. However, the usability of entity references in XHTML is affected by how the document is being processed: * If the document is read by a conforming HTML processor, then only the 252 HTML character entities can safely be used. The use of ' or custom entity references may not be supported and may produce unpredictable results. * If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset. * If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset. Because of the special ' case mentioned above, only ", &, <, and > will work in all processing situations. See also * Character encodings in HTML * SGML entity References * Unicode Consortium. See also: Unicode Consortium ** UnicodeData.txt from the Unicode Consortium * World Wide Web Consortium. See also: World Wide Web Consortium ** XML 1.0 spec ** HTML 2.0 spec ** HTML 3.2 spec ** HTML 4.0 spec ** HTML 4.01 spec ** XHTML 1.0 spec * The normative reference to RFC 2070 (still found in DTDs defining the character entities for HTML or XHTML) is historic; this RFC (along with other RFC's related to different part of the HTML specification) has been deprecated in favor of the newer informational RFC 2854 which defines the "text/html" MIME type and references directly the W3C specifications for the actual HTML content. External links * BabelPad a free Unicode text editor that supports many character sets * HTML entities visual likeness tool * List of Unicode code points (for numerical references) Category:Character encoding XML and HTML character entity references Category:HTML Category:XML eo:Listo de speciale nomataj signoj de HTML ko:XML의 글자 엔티티 ia:Tabula de symbolos he:ישויות HTML ו-XML ru:Мнемоники в HTML